#include "ros/ros.h"
#include "beginner_tutorials/AddTwoInts.h"

bool add(beginner_tutorials::AddTwoInts::Request &req,
        beginner_tutorials::AddTwoInts::Response &res)
{
    long int sum = req.a + req.b;
    ROS_INFO("request:x=%ld,y=%ld,sum=%ld",(long int)req.a,(long int)req.b,sum);
    res.sum = sum;

    return true;
}


int main(int argc, char **argv)
{
    ros::init(argc,argv,"add_two_ints_server");
    ros::NodeHandle n;

    ros::ServiceServer service = n.advertiseService("add_two_ints",add);
    ROS_INFO("ready to add_two_ints");
    ros::spin();

    return 0;
}
